home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 001-025 / scopedisk1 / dnet / doc / dnetlib.doc next >
Text File  |  1995-03-18  |  4KB  |  128 lines

  1.  
  2.  
  3.                DNET LINK LIBRARY
  4.  
  5.     Link with your server's and client programs.
  6.  
  7.  
  8.         SERVER CALLS
  9.  
  10.     listenport    = DListen(port#)
  11.     chanport    = DAccept(listenport)
  12.           DNAAccept(listenport)
  13.           DPri(chanport, priority)      (not implemented yet)
  14.         act = DNRead(chanport, buf, bytes)  (see below)
  15.         act = DRead(chanport, buf, bytes)   (see below)
  16.         act = DWrite(chanport, buf, bytes)
  17.           DClose(chanport)
  18.           DUnListen(listenport)
  19.  
  20.           DQuit()                       cause remote end to quit
  21.  
  22.         APPLICATION CALLS
  23.  
  24.     chanport    = DOpen(host, port#, priority)
  25.         act = DNRead(chanport, buf, bytes)  (see below)
  26.         act = DRead(chanport, buf, bytes)   (see below)
  27.         act = DWrite(chanport, buf, bytes)
  28.           DEof(chanport)
  29.           DClose(chanport)
  30.  
  31. General notes:
  32.     The calls are self-contained in that you can spawn off a task
  33.     when you've determined that an a connection is pending.  The
  34.     spawned task must do the actual DNAccept() call, however, and
  35.     you cannot share file descriptors.  Only the original task that
  36.     did the listen can WaitPort() on the listen port.
  37.  
  38.     The calls are not extremely efficient at the momement, but since
  39.     the network, by virtue of being on a serial line, is so slow,
  40.     it doesn't really matter.
  41.  
  42.     DEOF()
  43.  
  44.     Eof a channel.    Implemented ONLY for the Amiga.  You cannot EOF
  45.     a channel if running between the Amiga and a UNIX machine.   This
  46.     is essentially an unsupported call, and you should use DCLose()
  47.     to close(and send an eof) on a channel.  The network handles it
  48.     just fine, but the UNIX side has no way of sending an EOF over
  49.     a socket without closing the socket.
  50.  
  51.  
  52.     DLISTEN()
  53.  
  54.     This call listens on a virtual port # (0-65535) for connections
  55.     from a remote host.  NULL is returned if the port is already
  56.     being listened on by somebody else.
  57.  
  58.     DACCEPT()
  59.  
  60.     Accepts connections over a virtual port #.  Several connections
  61.     may be accepted and worked on simultaniously.  NULL is returned if
  62.     there are no pending connections.  You can WaitPort() on the
  63.     listenport to wait for new connections.
  64.  
  65.     DNAACCEPT()
  66.  
  67.     Don't accept connections over a virtual port #.  If there is a
  68.     connection pending, it will return an error on the other end.
  69.  
  70.     DUNLISTEN()
  71.  
  72.     Stop listening on a virtual port #.  Any pending requests
  73.  
  74.     DPRI()
  75.  
  76.     Set the priority of a channel (-128 lowest to 127 highest).
  77.     The priority only effects throughput when two or more channels
  78.     at different priorities are transfering data at the same time.
  79.  
  80.     Not currently implemented.. priority is what you set in DOpen()
  81.  
  82.     DNREAD()
  83.  
  84.     Read data from a channel.  0 is a valid return value, meaning that
  85.     no data is currently ready to read.  You can WaitPort() on the
  86.     channel port to wait for data (or EOF).  A negative value is
  87.     returned on EOF or failure.
  88.  
  89.     error codes:
  90.             -1    EOF on channel
  91.             -2    Remote end CLOSED the channel (not implemented)
  92.  
  93.     DREAD()
  94.  
  95.     Read data from a channel.  The number of bytes requested are
  96.     returned, unless the other end closed it's side in which case
  97.     fewer than the number of bytes requested will be returned.  That
  98.     is, this call will BLOCK waiting for data.
  99.  
  100.     A negative value is returned on EOF or failure.
  101.  
  102.  
  103.     DWRITE()
  104.  
  105.     Write data to a channel.  The return value is either the # bytes
  106.     written, or a negative error code.
  107.  
  108.             -1    Remote end REOF'd the channel
  109.             -2    Remote end CLOSED the channel
  110.  
  111.             note: not much distinction between the two
  112.             currently.
  113.  
  114.     DCLOSE()
  115.  
  116.     Close a channel.
  117.  
  118.     DOPEN()
  119.  
  120.     Application side OPEN().... Open a port# on a remote host.  Returns
  121.     a channel port or NULL.  The priority is from -127 (lowest) to
  122.     126 (highest).
  123.  
  124.  
  125.  
  126.  
  127.  
  128.